CC=arm-linux-gcc -Wall
LIB=-lmhknit

#CC=gcc -g -Wall

program=bin/libmhfile.so

all:$(program)

SOURCES = $(wildcard *.c)
OBJS := $(patsubst %.c,%.o, $(SOURCES))

%.d: %.c
	@set -e; rm -f $@; \
	$(CC) -MM  $< > $@.$$$$; \
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
	rm -f $@.$$$$

sinclude $(SOURCES:.c=.d)

$(program):$(OBJS)
	$(CC) -fpic -shared $(LIB) -o $(program) $(OBJS)

clean:
	-rm -f $(program)
	-rm -f *.o *.d *.d.*
